package com.junqi.live.room.domain.service.impl;

import com.junqi.live.room.domain.bo.LiveTypeBo;
import com.junqi.live.room.domain.convert.LiveTypeBoConvert;
import com.junqi.live.room.domain.service.LiveTypeDomainService;
import com.junqi.live.room.infra.basic.entity.LiveType;
import com.junqi.live.room.infra.basic.service.LiveTypeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class LiveTypeDomainServiceImpl implements LiveTypeDomainService {


    @Resource
    LiveTypeService liveTypeService;

    @Override
    public List<LiveTypeBo> listAll() {
        List<LiveType> liveTypes = liveTypeService.list();
        List<LiveTypeBo> liveTypeBos = liveTypes.stream().map(m -> LiveTypeBoConvert.INSTANCE.convertEntityToBO(m)).collect(Collectors.toList());
        return liveTypeBos;
    }
}
